<link href="//www.12301.cc/css/withdraw.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="//www.12301.cc/css/accourt.css"/>
<style>
#if{border:none;}
#PopWindow{ text-align:left; border:8px solid #767576; padding:20px; }
#PopWindow h3.close{padding:5px 10px;}
#PopWindow a.fr{float:right; cursor:pointer;}
.account em{color:#FF5500; font-size:18px; font-weight:bold }
.rightWrap .bank_r .bank_rt h4{ float:left; width:160px; padding: 5px;font-size:16px; margin-top:0;text-align:right;}
.rightWrap .bank_r .bank_rt .error{display:none; background:url(//www.12301.cc/images/jingao.png) 0 19px no-repeat; padding:18px; margin-left:20px;}
.account{color:#303D46; float: left;width:180px;  height:20px; line-height:20px; padding:6px; background:#fff; border:1px solid #dbdbdb;border-radius: 3px;-moz-border-radius:3px;}
.account:focus{border-color: #0797D9; color: #0797D9;}
.confirm{width:103px;height: 34px;background: url(//www.12301.cc/images/confirm.png) no-repeat;border: 0;margin-bottom: 30px;cursor: pointer;margin-top: 10px;margin-left: 170px;}
.mon_tran{ width:100px;}
#vbutton{border: 0 none;background: #3dBA3F;color: #fff;padding: 8px;margin-top: -1px;border-radius: 3px;margin-left: 10px;-moz-border-radius: 3px;}
.setFont{line-height:32px; margin-left: 10px; font-size:16px;}
.setFont_a{margin-left: 170px; margin-top:0; color: #F07845;}

</style>
<script src="//www.12301.cc/js/ui/PopWindow.js"></script>
<script type="text/javascript">
function diff(){
	if($.trim($("#account").val())!=$.trim($("#account_ok").val())){
		$("#error").show();
	}
	else{
		$("#error").hide();
	}
}
function difff(){
    if($.trim($("#account_ok").val())!=""){
        if($.trim($("#account").val())!=$.trim($("#account_ok").val())){
            $("#error").show();
        }
        else{
            $("#error").hide();
        }
    }
}
function sub(){
    var vcode= $.trim($("#vcode").val());
    if(vcode=="")
    {
        alert("请输入验证码");
        return false;
    }
   else if($("#error").css('display')=='inline'){
        alert('两次输入的帐号不一样');
        return false;
    }
	var account= $.trim($("#account").val());
	var money= $.trim($("#money").val());
	if(account.length<6 && account!="test" && account!="test1"){
		alert("账号不正确");
		return;
	}
	else
    {
		$.ajax({url:"{$wxhgetflie}",data:{account:account},success:function(t){
			if(t){
				if(confirm('确定向'+t+'（'+account+'）转账'+money+'元？')){
					document.forms['move'].submit();
				}
			}
			else{
				alert("转账对象不存在,请确认后重试。");
			}
		}});
	}
}
    var countdown=60;
    function settime(val)
    {
        var account= $.trim($("#account").val());
        var money= $.trim($("#money").val());
        if(account==""){
            alert('请输入账号！');
            return false;
        }else if(account.length<6 && account!="test" && account!="test1"){
            alert("账号不正确");
            return;
        }else if(account!=$("#account_ok").val()){
            alert('两次输入的帐号不一样！');
            return false;
        }else if(money=="")
        {
            alert('请输入转账金额！');
            return false;
        }else if(!/^[0-9]+(.[0-9]{0,2})?$/.test(money))
        {
            alert('金额栏请输入正确格式！');
            return false;
        }
        else
        {
            restime(val);
        }

    }
        var thetime=Date.parse(new Date())/1000;
        function restime(val)
        {
            var account= $.trim($("#account").val());
            var money= $.trim($("#money").val());

            var times= $.trim($("times").val());
            if (countdown == 60) {
                val.removeAttribute("disabled");
                val.value="获取验证码";
                $.ajax({
                        type: "GET",
                        url: "{$wxhtransfer}",
                        data: {stype:$("#stype").val(),account:$("#account").val(),money:$("#money").val()},
                        dataType: "json",
                        success:function(data){
                            if(data.status=='suc')
                            {
                                alert("验证码发送成功！")
                                countdown--;
                                restime(val);
                            }
                            else if(data.status=='empty')
                            {
                                alert("用户不存在，请重新输入！")
                            }
                            else if(data.status=='fail')
                            {
                                alert("发送失败，请稍后重试！")
                            }
                            else if(data.status=='lesstime')
                            {
                                alert("时间没超过一分钟，请稍后点击！")
                            }
                            else if(data.status=='message')
                            {
                                alert("信息不存在！")
                            }

                        }
                    }
                )

            }
            else if(countdown<60 && countdown>0)
            {
                val.setAttribute("disabled", true);
                  val.style.background="#CCC";
                val.value="重新发送(" + countdown + ")";
                countdown--;
                if(countdown==0)
                {
                    countdown=60;
                    val.removeAttribute("disabled");
                     val.style.background="#3dBA3F";
                    val.value="获取验证码";
                }
                else
                {
                    setTimeout(function()
                    {
                        restime(val)
                    },1000)
                }
            }
        }
</script>
<div id="right" class="rightWrap"><!--BEGIN OF RIGHT-->
	<?include("/var/www/html/new/d/tpl/account_bar.tpl")?>
	<div class="aboutmoney">
		<span class="absp">当前账户余额：<strong class="money">{$money}</strong> 元</span>
	</div>
	<div class="bank_r">
	<iframe name="ifr" style="display:none;"></iframe>
	<form action="{$wxhcall}" name="move" target="ifr">
		<input type="hidden" name="act" value="m" />
		<div class="bank_rt">
			<h4>账号：</h4>
			<span><input type="text" name="account" id="account" class="account" onblur="difff()"  /></span>
		</div>
		<div class="bank_rt">
			<h4>确认账号：</h4>
			<span><input type="text" name="account_ok" id="account_ok" class="account" onblur="diff()" /></span><span id="error" class="error">您两次输入账号不一致，请重新输入</span>
		</div>
		<div class="bank_rt">
			<h4>转账金额：</h4>
			<span><input type="text" name="money" id="money" class="account mon_tran" value="" /><em class="setFont"> 元</em></span>
		</div>
        <div class="bank_rt">
            <h4>手机验证码：</h4>
            <span><input type="text" name="vcode" id="vcode" class="account mon_tran" value="" /> </span>
            <span><input type="button" id="vbutton" class="vcode button" value="获取验证码" onclick="settime(this)"/> </span>
            <span style="margin-left: 10px"><font color="red" size="2px">短信发送到绑定帐号的手机</font></span>
            <span><input type="hidden" id="times" class="vcode button" value="0" /></span>
            <span><input type="hidden" id="stype" class="vcode button" name="stype" value="transfer" /></span>
        </div>
		<div class="bank_rt">
			<h4>&nbsp;</h4>
			<span><input type="button" class="confirm" onclick="sub()"/></span>
		</div>
	</form>
	</div>
	<div class="aboutr">
		<!-- <h3>关于转账</h3>
		<p> 1、资金帐户金额满<span class="redm">100元</span>，可以转账操作。<br />
			2、最高转账金额不能超过<span class="redm">20000元</span>。<br />
			3、转账申请将会在24小时到72小时内进行处理。<br />
			4、每个工作日17:00前，财务人员会对转账申请进行处理，17:00后提交的申请，将在下个工作日处理。
		</p> -->
	</div>
</div><!--EOF RIGHT-->
<?php
$historytime=$_SESSION["timer"];
$time=time()-$historytime;
if($time<60)
{
    echo "<script type=\"text/javascript\">$(\"#vbutton\").attr(\"disabled\", true)</script>";
    echo "<script type=\"text/javascript\">$(\"#vbutton\").css(\"background\", \"#ccc\")</script>";
}
?>